//
//  JSMLeavingHeaderCollectionDetailsTableViewCell.m
//  TakeYouTourTogether
//
//  Created by dllo on 15/12/2.
//  Copyright © 2015年 king. All rights reserved.
//

#import "JSMLeavingHeaderCollectionDetailsTableViewCell.h"

@implementation JSMLeavingHeaderCollectionDetailsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.mainImageView = [[BaseImageView alloc] init];
    [self.contentView addSubview:self.mainImageView];
    
    self.descriptionLabel = [[BaseLabel alloc] init];
    [self.contentView addSubview:self.descriptionLabel];
    self.descriptionLabel.numberOfLines = 0;
    [self.descriptionLabel sizeToFit];
    
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:15], NSFontAttributeName, nil];
    CGRect wordRect = [self.descriptionLabel.text boundingRectWithSize:CGSizeMake(TableViewCellWidth - 40, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
//    [self.mainImageView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.contentView).with.offset(15);
//        make.right.equalTo(self.contentView).with
//    }];
    self.descriptionLabel.frame = CGRectMake(20, 10, TableViewCellWidth - 40, wordRect.size.height);
    self.mainImageView.frame = CGRectMake(15, 10 + self.descriptionLabel.frame.size.height, TableViewCellWidth - 30, (TableViewCellWidth - 30) * 2 / 3);
    
    
}
@end
